<% @main_header = "#{link_to('Ptrack:', '/')} #{@project.name if @project}: Contacts" %>

<div id="info" class='column span-8' style="width: 100%;">

  <div style="float: left; width: 100%;">

    <h3><%= link_to 'Create New Contact', :action => 'new' %></h3>

  </div>
</div>

<div id="info" class='column span-8' style="width: 100%;">
  <div style="float: left; width: 100%;">
    <fieldset>
      
  <% unless @project %>
    <legend>All Contacts</legend>
  <% else %>
	<legend>Project Contacts</legend>
  <% end %>

      <table>
        <tr>
          <td style="font-weight: bold;">
            Name
          </td>
          <td style="font-weight: bold;">
            Surname
          </td>
          <td style="font-weight: bold;">
            Company
          </td>
          <td style="font-weight: bold;">
            Phone
          </td>
          <td style="font-weight: bold;">
            Email
          </td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
        <tr>
          <td colspan="7">
            <hr>
          </td>
        </tr>

        <% for contact in @contacts %>
          <tr>
            <td><%=h contact.name %></td>
            <td><%=h contact.surname %></td>
            <td><%=h contact.company %></td>
            <td><%=h contact.phone %></td>
            <td><%=link_to contact.email,"mailto:#{contact.email}" %></td>

            <td><%= link_to "Show", :action => "show", :id => contact %></td>
            <td><%= link_to "Edit", :action => "edit", :id => contact%></td>
            <td><%= link_to("Delete", {:action => "destroy", :id => contact}, :method => :delete, :confirm => "Are you sure want to delete #{contact.full_name} ?")%></td>
          </tr>
        <% end %>

      </table>
    </fieldset>
  </div>
</div>
